home *** CD-ROM | disk | FTP | other *** search
/ AMOS PD CD / amospdcd.iso / 501-525 / apd520 / asstd_programs / city square.amos / city square.amosSourceCode
AMOS Source Code  |  1991-01-15  |  756b  |  38 lines

  1. ' CITY SQUARE
  2. ' A simple routine that uses recursion.  
  3. ' Robert Farnsworth. 
  4. '
  5. ' Speed Comparison: (before I AMOSed it) 
  6. ' GFA Basic  - 17.8 sec  
  7. ' AMOS1.2    - 14.6 sec  
  8. ' AmigaBasic - NA (Can't do recursion) 
  9. '
  10. Screen Open 0,640,256,4,Hires
  11. Colour 0,$EAF
  12. Flash Off : Curs Off : Cls 0
  13. '
  14. S=Timer
  15. GRID[320,128,400,6]
  16. Print(Timer-S)/50.0
  17. End 
  18. '
  19. Procedure GRID[X,Y,S,L]
  20.    If L>0
  21.       SQUARE[X,Y,S]
  22.       ' top left 
  23.       GRID[X-S/4,Y-S/8,S/2-4,L-1]
  24.       ' top right
  25.       GRID[X+S/4,Y-S/8,S/2-4,L-1]
  26.       ' bottom left
  27.       GRID[X-S/4,Y+S/8,S/2-4,L-1]
  28.       ' bottom right 
  29.       GRID[X+S/4,Y+S/8,S/2-4,L-1]
  30.    End If 
  31. End Proc
  32. '
  33. Procedure SQUARE[X,Y,SIDE]
  34.    Shared C
  35.    Add C,1,1 To 3
  36.    Ink C
  37.    Box X-SIDE/2,Y-SIDE/4 To X+SIDE/2,Y+SIDE/4
  38. End Proc